import { Resource } from './resource.model'
import { ChildEntity, Column, JoinTable, ManyToMany } from 'typeorm'
import { ServerTags } from '@boticord/consts'
import { User } from '@boticord/users-client'

@ChildEntity()
export class Server extends Resource {
  @Column()
  declare memberCount: number

  @Column({ default: null, nullable: true })
  declare bannerURL?: string

  @Column('timestamp with time zone', { nullable: false, default: () => 'CURRENT_TIMESTAMP' })
  declare createdDate: Date

  // from Resource
  declare tags: ServerTags[]

  @ManyToMany(() => User)
  @JoinTable()
  declare moderators: User[]
}
